#ifndef __LORA_COM_H_
#define __LORA_COM_H_



#define DEV_NUM      0xff
#define DEV_CHANNEL   0x19

#define LORA_RECV_BUF_LENGTH    50
#define LORA_RX_LENGTH 		9


#define SET_M0_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET)
#define SET_M0_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET)


#define SET_M1_L HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET)
#define SET_M1_H HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET)


typedef struct
{
    unsigned char UartRcvFinish_Flag;    //定时器判断接收数据标志位，接收完一次数据之后置位，用户根据此标志位获取数据，用完用清零
    unsigned char UartRxDeal_Flag;      //防止覆盖收到的数据，收到数据后为False，处理完数据后置位方可进行后续数据接收
    unsigned char UartRvByte_Flag;       //串口接收到数据将置位，用于定时器判断数据是否超过设定间隔时间UartRxdCnt
    unsigned char  UartRxdCnt;    //用于设定数据间隔时间，在该间隔时间以外的数据将不会接收，直到当前数据处理完毕即nFlag_UsartRxDeal=true
    unsigned short UartRxdIdx;   //数据字节索引
    unsigned short UartRxdLen;   //数据长度
}UART_RcvPar; // USART接收数据参数；

extern UART_RcvPar str_Lora_RecvDeal;

extern unsigned char Uart_Loar_Recv_Buf[LORA_RECV_BUF_LENGTH];

extern unsigned int  ui_LocalIdleWorkMin;
extern unsigned char uc_SetLoraNumFlag;

extern void Lora_GPIO_Init(void);
extern void ReadLoraPara(void);
extern void Lora_InitPara(void);
extern void HeartReport(void);
extern void TemperatureCtrlEventReport(void);
extern void TimeCtrlEventReport(void);
extern void KeyEventReport(void);
extern void RemoteEventReport(void);
extern void ClockCalibrationEvent(void);

extern void ReprotEvent(unsigned char EventType);
extern void ReprotAdjustEvent(unsigned char EventType);

extern void RecvLoraData(void);
extern void ReadLoraConfigInfo(void);

extern void TestLoraSendRecv(unsigned char num);
extern void SetLoraNodeNum(void);
#endif


